package news.dao;

import news.example.Publish;
import news.util.BaseDao;

/**
 * @author JiangJ
 * @date 2022/3/2 20:15
 */
public class AddTopicImpl implements IAddTopicDao {
    BaseDao baseDao = new BaseDao();

    /**
     * 增加
     *
     * @param topicName
     */
    @Override
    public void addTopic(String topicName) {
        //√
        try {
            baseDao.openDB();
            String sql = "INSERT INTO news_topic(topicname) values(?)";
            baseDao.ps = baseDao.conn.prepareStatement(sql);
            baseDao.ps.setString(1, topicName);
            baseDao.ps.execute();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }




}
